<#assign menu="goods">
<#assign submenu="add_goods">
<#include "../../manage/head.ftl">
<!--main content start-->
<section id="main-content">
    <section class="wrapper">
        <!-- page start-->
        <form id="add_goods_form" class="form-horizontal" action="${BASE_PATH}/manage/goods/add.json"
              autocomplete="off" method="post"
              enctype="multipart/form-data">
            <div class="row">
            <#--<input type="hidden" name="goodsId">-->

                <div class="col-lg-12">
                    <section class="panel">
                        <header class="panel-heading">
                            添加商品
                        </header>
                        <div class="panel-body">
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">主题图片</label>

                                <div class="col-sm-10">
                                    <input type="file" name="file"
                                           id="file">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">展示图片</label>

                                <div class="col-sm-10">
                                    <input type="file" name="file1"
                                           id="file">
                                    <input type="file" name="file2"
                                           id="file">
                                    <input type="file" name="file3"
                                           id="file">
                                </div>

                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">商品名字</label>

                                <div class="col-sm-10">
                                    <input type="text" style="font-size:15px;width: 300px;" class="form-control"
                                           name="name"
                                           placeholder="商品名字" id="name">
                                    </input>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">显示价格</label>

                                <div class="col-sm-10">
                                    <input type="text" style="font-size:15px;width: 300px;" class="form-control"
                                           name="price"
                                           placeholder="显示价格" id="price">
                                    </input>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">类型</label>

                                <div class="col-sm-10">
                                    <select class="form-control" name="typeId" style="font-size:15px;width: 300px;"
                                            id="goodsType-select">
                                    <#list typeList as type>

                                        <option value="${type.id}">
                                        ${type.name}
                                        </option>

                                    </#list>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">品牌</label>

                                <div class="col-sm-10">
                                    <select class="form-control" name="brandId" style="font-size:15px;width: 300px;"
                                            id="googsBrand-select">
                                    <#list brandList as e>
                                        <option value="${e.id}">
                                        ${e.name}
                                        </option>
                                    </#list>
                                    </select>
                                </div>
                            </div>


                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">原料</label>

                                <div class="col-sm-10">
                                    <input type="text" style="font-size:15px;width: 300px;" class="form-control"
                                           name="material"
                                           placeholder="原料" id="material">
                                    </input>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">生产商</label>

                                <div class="col-sm-10">
                                    <input type="text" style="font-size:15px;width: 300px;" class="form-control"
                                           name="manufacturer"
                                           placeholder="生产商" id="manufacturer">
                                    </input>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">备注</label>

                                <div class="col-sm-10">
                                    <input type="text" style="font-size:15px;width: 300px;" class="form-control"
                                           name="mark"
                                           placeholder="备注" id="mark">
                                    </input>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">首页展示</label>

                                <div class="col-sm-10">
                                    <select class="form-control" name="categoryId" style="font-size:15px;width: 300px;"
                                            id="category-select">

                                        <option value="1">今日精选</option>
                                        <option value="2">品牌合作</option>

                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">配送费</label>

                                <div class="col-sm-10">
                                    <input type="text" style="font-size:15px;width: 300px;" class="form-control"
                                           name="shippingPrice"
                                           placeholder="配送费" id="mark">
                                    </input>
                                </div>
                            </div>


                        </div>
                        <div class="form-group">
                            <div class="col-lg-offset-2 col-lg-10">
                                <button class="btn btn-shadow btn-primary" type="submit">发布</button>
                            </div>
                        </div>
                </div>
    </section>
    </div>
    </div>
    </form>
    <!-- page end-->
</section>
</section>
<!--main content end-->
<script type="text/javascript">
    $(function () {
        $('#add_goods_form').ajaxForm({
            dataType: 'json',
            success: function (data) {
                if (data.result) {
                    bootbox.alert("保存成功，将刷新页面", function () {
                        window.location.reload();
                    });
                } else {
                    showErrors($('#add_goods_form'), data.errors);
                }
            }
        });

        $('.js_create_time').datetimepicker({
            language: 'zh-CN',
            format: "yyyy-mm-dd",
            weekStart: 1,
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            minView: 2,
            forceParse: 0
        });
    });
    $("#goodsType-select").val("");
    $("#googsBrand-select").val("");
    $("#category-select").val("");

</script>
<#include "../../manage/foot.ftl">